/*
七牛云配置
*/
import qiniu from 'qiniu'
import setting from './setting'

// 上传凭证

//  AK
const AK = setting.qiniu.AK
//  SK
const SK = setting.qiniu.SK
const mac = new qiniu.auth.digest.Mac(AK, SK)
const options = {
  scope: setting.qiniu.scope,
  expires: 99999999999
}
const token = new qiniu.rs.PutPolicy(options).uploadToken(mac)
const domain = setting.qiniu.domain
const qiniuurl = setting.qiniu.qiniuurl
function str(num){
   var str = '0123456789qwertyuioplkjhgfdsazxcvbnm'
   var string = ''
   for(var i = 0;i<num;i++){
     string += str[Math.floor(Math.random()*36)]
   }
   return string
}
export default {
  token,
  str,
  domain,
  qiniuurl
}